﻿Public Class frmStaffMenu
    Public Sub OvertimeManager()
        If My.Application.OpenForms.OfType(Of frmOvertimeManager)().Any() Then
            'Loads frmOvertimeManager
            frmOvertimeManager.Hide()
            frmOvertimeManager.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmLeaveManager)().Any() Then
            'Loads frmOvertimeManager
            frmOvertimeManager.Show()
            frmLeaveManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmAttendanceManager)().Any() Then
            'Loads frmOvertimeManager
            frmOvertimeManager.Show()
            frmAttendanceManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmInfractionManager)().Any() Then
            'Loads frmOvertimeManager
            frmOvertimeManager.Show()
            frmInfractionManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPaymentManager)().Any() Then
            'Loads frmOvertimeManager
            frmOvertimeManager.Show()
            frmPaymentManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPayslipManager)().Any() Then
            'Loads frmOvertimeManager
            frmOvertimeManager.Show()
            frmPayslipManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmStaffManager)().Any() Then
            'Loads frmOvertimeManager
            frmOvertimeManager.Show()
            frmStaffManager.Close()
        End If
    End Sub
    Public Sub LeaveManager()
        If My.Application.OpenForms.OfType(Of frmOvertimeManager)().Any() Then
            'Loads frmLeaveManager
            frmLeaveManager.Show()
            frmOvertimeManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmLeaveManager)().Any() Then
            'Loads frmLeaveManager
            frmLeaveManager.Hide()
            frmLeaveManager.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmAttendanceManager)().Any() Then
            'Loads frmLeaveManager
            frmLeaveManager.Show()
            frmAttendanceManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmInfractionManager)().Any() Then
            'Loads frmLeaveManager
            frmLeaveManager.Show()
            frmInfractionManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPaymentManager)().Any() Then
            'Loads frmLeaveManager
            frmLeaveManager.Show()
            frmPaymentManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPayslipManager)().Any() Then
            'Loads frmLeaveManager
            frmLeaveManager.Show()
            frmPayslipManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmStaffManager)().Any() Then
            'Loads frmLeaveManager
            frmLeaveManager.Show()
            frmStaffManager.Close()
        End If
    End Sub
    Public Sub AttendanceManager()
        If My.Application.OpenForms.OfType(Of frmOvertimeManager)().Any() Then
            'Loads frmAttendanceManager
            frmAttendanceManager.Show()
            frmOvertimeManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmLeaveManager)().Any() Then
            'Loads frmAttendanceManager
            frmAttendanceManager.Show()
            frmLeaveManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmAttendanceManager)().Any() Then
            'Loads frmAttendanceManager
            frmAttendanceManager.Hide()
            frmAttendanceManager.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmInfractionManager)().Any() Then
            'Loads frmAttendanceManager
            frmAttendanceManager.Show()
            frmInfractionManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPaymentManager)().Any() Then
            'Loads frmAttendanceManager
            frmAttendanceManager.Show()
            frmPaymentManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPayslipManager)().Any() Then
            'Loads frmAttendanceManager
            frmAttendanceManager.Show()
            frmPayslipManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmStaffManager)().Any() Then
            'Loads frmAttendanceManager
            frmAttendanceManager.Show()
            frmStaffManager.Close()
        End If
    End Sub
    Public Sub InfractionManager()
        If My.Application.OpenForms.OfType(Of frmOvertimeManager)().Any() Then
            'Loads frmInfractionManager
            frmInfractionManager.Show()
            frmOvertimeManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmLeaveManager)().Any() Then
            'Loads frmInfractionManager
            frmInfractionManager.Show()
            frmLeaveManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmAttendanceManager)().Any() Then
            'Loads frmInfractionManager
            frmInfractionManager.Show()
            frmAttendanceManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmInfractionManager)().Any() Then
            'Loads frmInfractionManager
            frmInfractionManager.Hide()
            frmInfractionManager.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmPaymentManager)().Any() Then
            'Loads frmInfractionManager
            frmInfractionManager.Show()
            frmPaymentManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPayslipManager)().Any() Then
            'Loads frmInfractionManager
            frmInfractionManager.Show()
            frmPayslipManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmStaffManager)().Any() Then
            'Loads frmInfractionManager
            frmInfractionManager.Show()
            frmStaffManager.Close()
        End If
    End Sub
    Public Sub PaymentManager()
        If My.Application.OpenForms.OfType(Of frmOvertimeManager)().Any() Then
            'Loads frmPaymentManager
            frmPaymentManager.Show()
            frmOvertimeManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmLeaveManager)().Any() Then
            'Loads frmPaymentManager
            frmPaymentManager.Show()
            frmLeaveManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmAttendanceManager)().Any() Then
            'Loads frmPaymentManager
            frmPaymentManager.Show()
            frmAttendanceManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmInfractionManager)().Any() Then
            'Loads frmPaymentManager
            frmPaymentManager.Show()
            frmInfractionManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPaymentManager)().Any() Then
            'Loads frmPaymentManager
            frmPaymentManager.Hide()
            frmPaymentManager.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmPayslipManager)().Any() Then
            'Loads frmPaymentManager
            frmPaymentManager.Show()
            frmPayslipManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmStaffManager)().Any() Then
            'Loads frmPaymentManager
            frmPaymentManager.Show()
            frmStaffManager.Close()
        End If
    End Sub
    Public Sub PayslipManager()
        If My.Application.OpenForms.OfType(Of frmOvertimeManager)().Any() Then
            'Loads frmPayslipManager
            frmPayslipManager.Show()
            frmOvertimeManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmLeaveManager)().Any() Then
            'Loads frmPayslipManager
            frmPayslipManager.Show()
            frmLeaveManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmAttendanceManager)().Any() Then
            'Loads frmPayslipManager
            frmPayslipManager.Show()
            frmAttendanceManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmInfractionManager)().Any() Then
            'Loads frmPayslipManager
            frmPayslipManager.Show()
            frmInfractionManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPaymentManager)().Any() Then
            'Loads frmPayslipManager
            frmPayslipManager.Show()
            frmPaymentManager.Close()
        ElseIf My.Application.OpenForms.OfType(Of frmPayslipManager)().Any() Then
            'Loads frmPayslipManager
            frmPayslipManager.Hide()
            frmPayslipManager.Show()
        ElseIf My.Application.OpenForms.OfType(Of frmStaffManager)().Any() Then
            'Loads frmPayslipManager
            frmPayslipManager.Show()
            frmStaffManager.Close()
        End If
    End Sub

    Private Sub btnOvertimeManager_Click(sender As Object, e As EventArgs) Handles btnOvertimeManager.Click
        OvertimeManager()
    End Sub

    Private Sub btnOveManager_Click(sender As Object, e As EventArgs) Handles btnOveManager.Click
        OvertimeManager()
    End Sub

    Private Sub btnLeaveManager_Click(sender As Object, e As EventArgs) Handles btnLeaveManager.Click
        LeaveManager()
    End Sub

    Private Sub btnLeaManager_Click(sender As Object, e As EventArgs) Handles btnLeaManager.Click
        LeaveManager()
    End Sub

    Private Sub btnAttendanceManager_Click(sender As Object, e As EventArgs) Handles btnAttendanceManager.Click
        AttendanceManager()
    End Sub

    Private Sub btnAttManager_Click(sender As Object, e As EventArgs) Handles btnAttManager.Click
        AttendanceManager()
    End Sub

    Private Sub btnInfractionManager_Click(sender As Object, e As EventArgs) Handles btnInfractionManager.Click
        InfractionManager()
    End Sub

    Private Sub btnInfManager_Click(sender As Object, e As EventArgs) Handles btnInfManager.Click
        InfractionManager()
    End Sub

    Private Sub btnPaymentManager_Click(sender As Object, e As EventArgs) Handles btnPaymentManager.Click
        PaymentManager()
    End Sub

    Private Sub btnPayManager_Click(sender As Object, e As EventArgs) Handles btnPayManager.Click
        PaymentManager()
    End Sub

    Private Sub btnPayslipManager_Click(sender As Object, e As EventArgs) Handles btnPayslipManager.Click
        PayslipManager()
    End Sub

    Private Sub btnSliManager_Click(sender As Object, e As EventArgs) Handles btnSliManager.Click
        PayslipManager()
    End Sub
End Class